<script>
import comMixin from "./comMixin.js";
export default {
  mixins: [comMixin],
  props:{
    height:{
        type:String|Number,
        default:19.79
    }
  },
  watch: {
    formData: {
      immediate: true,
      deep: true,
      handler() {
        const value = this.formData[this.prop];
        this.value = value;
      },
    },
    value(data){
      this.onChange(data)
    }
  },
  mounted(){
    this.$watch('$refs.tinym.tinymceHtml',(value)=>{
        this.value = value;
    })
  },
  methods:{
    onChange(data){
      this.formData[this.prop] = data;
      this.$emit("update:data", data);
    }
  },
  beforeDestroy(){
    this.$off()
  },
  render() {
    return (
      <div class="aone-form-item">
        <div class="radio">
          <w-tinym ref="tinym" value={this.value} height={this.height}/>
        </div>
      </div>
    );
  },
};
</script>